/**
 * 添加银行卡
 * author wim
 */
import 'package:flutter/material.dart';
import 'package:xlive_switch/xlive_switch.dart';
import '../base/Constant.dart';
import 'dart:ui';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class AddBankPage extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    // TODO: implement createState
    return AddBankView();
  }
}

class AddBankView extends State<AddBankPage> {
  @override
  Widget build(BuildContext context) {
    ScreenUtil.instance = ScreenUtil(width: 750, height: 1334)..init(context);
    return new Scaffold(
      appBar: new AppBar(
        title: new Text(
          "添加银行卡",
          style: TextStyle(
              fontSize: ScreenUtil.getInstance().setSp(BIG_FONT_SIZE),
              color: Colors.black),
        ),
        elevation: 0.2,
        backgroundColor: Colors.white,
        brightness: Brightness.light,
        centerTitle: true,
        iconTheme: new IconThemeData(color: Colors.black),
      ),
      resizeToAvoidBottomPadding: false, //输入框抵住键盘
      body: new Container(
        color: divideColor,
        child: new Column(
          children: <Widget>[
            Container(
              height: ScreenUtil.getInstance().setHeight(DP_10),
            ),
            new Container(
              padding: EdgeInsets.all(
                ScreenUtil.getInstance().setHeight(DP_15),
              ),
              color: white,
              child: Row(
                children: <Widget>[
                  Expanded(
                    flex: 1,
                    child: Text('银行',
                        style: TextStyle(
                            fontSize: ScreenUtil.getInstance()
                                .setSp(NORMAL_FONT_SIZE))),
                  ),
                  Expanded(
                    flex: 3,
                    child: new TextField(
                      maxLines: 1,
                      cursorColor: mainColor,
                      keyboardAppearance: Brightness.light,
                      decoration: new InputDecoration(
                          hintText: "选择银行",
                          border: InputBorder.none,
                          hintStyle: TextStyle(
                              fontSize: ScreenUtil.getInstance()
                                  .setSp(NORMAL_FONT_SIZE))),
                    ),
                  )
                ],
              ),
            ),
            new Container(
              margin: EdgeInsets.fromLTRB(0, 1, 0, 0),
              padding: EdgeInsets.all(
                ScreenUtil.getInstance().setHeight(DP_15),
              ),
              color: Colors.white,
              child: Row(
                children: <Widget>[
                  Expanded(
                    flex: 1,
                    child: Text(
                      '持卡人',
                      style: TextStyle(
                          fontSize:
                              ScreenUtil.getInstance().setSp(NORMAL_FONT_SIZE)),
                    ),
                  ),
                  Expanded(
                    flex: 3,
                    child: new TextField(
                      maxLines: 1,
                      cursorColor: mainColor,
                      keyboardAppearance: Brightness.light,
                      decoration: new InputDecoration(
                          hintText: "持卡人姓名",
                          border: InputBorder.none,
                          hintStyle: TextStyle(
                              fontSize: ScreenUtil.getInstance()
                                  .setSp(NORMAL_FONT_SIZE))),
                    ),
                  )
                ],
              ),
            ),
            new Container(
              margin: EdgeInsets.fromLTRB(0, 1, 0, 0),
              padding: EdgeInsets.all(
                ScreenUtil.getInstance().setHeight(DP_15),
              ),
              color: Colors.white,
              child: Row(
                children: <Widget>[
                  Expanded(
                    flex: 1,
                    child: Text('卡号',
                        style: TextStyle(
                            fontSize: ScreenUtil.getInstance()
                                .setSp(NORMAL_FONT_SIZE))),
                  ),
                  Expanded(
                    flex: 3,
                    child: new TextField(
                      maxLines: 1,
                      keyboardAppearance: Brightness.light,
                      cursorColor: mainColor,
                      decoration: new InputDecoration(
                          hintText: "银行卡号",
                          border: InputBorder.none,
                          hintStyle: TextStyle(
                              fontSize: ScreenUtil.getInstance()
                                  .setSp(NORMAL_FONT_SIZE))),
                    ),
                  )
                ],
              ),
            ),
            new Container(
              margin: EdgeInsets.fromLTRB(0, 1, 0, 0),
              padding: EdgeInsets.all(
                ScreenUtil.getInstance().setHeight(DP_15),
              ),
              color: Colors.white,
              child: Row(
                children: <Widget>[
                   Expanded(
                      child: Text(
                        '默认卡号',
                        style: TextStyle(
                            fontSize: ScreenUtil.getInstance()
                                .setSp(NORMAL_FONT_SIZE),
                            color: Colors.black87),
                      ),
                    ),
                    XlivSwitch(
                      value: true,
                      activeColor: mainColor,
                      unActiveColor: Colors.grey, // 激活时原点颜色
                      onChanged: (bool val) {
                        // checkInform();
                      },
                    )
                ],
              ),
            ),
            new Container(
              width: double.infinity,
              height: ScreenUtil.getInstance().setHeight(DP_80),
              margin: EdgeInsets.all(ScreenUtil.getInstance().setHeight(DP_80)),
              decoration: new BoxDecoration(
                   color:mainColor,
                  borderRadius: BorderRadius.circular(
                      ScreenUtil.getInstance().setHeight(DP_80))),
              padding: EdgeInsets.fromLTRB(0.0, 0.0, 0.0, 0.0),
              child: new FlatButton(
                child: new Padding(
                  padding: EdgeInsets.all(0.0),
                  child: new Text(
                    "确认添加",
                    style: new TextStyle(
                        color: Colors.white,
                        fontSize:
                            ScreenUtil.getInstance().setSp(NORMAL_FONT_SIZE)),
                  ),
                ),
                onPressed: () {},
              ),
            )
          ],
        ),
      ),
    );
  }
}
